Recipe to build pydantic-core (required for Pydantic 2) - #1413
Conversation
|
@freakboy3742: I haven't looked at this yet, but it might be relevant to what you're working on. |
|
Great job @pax0r! I can’t wait for it to be merged. |
|
Thanks for the PR. To add a new package, we need a test script to verify that it works. Please do the following:
|
| `fortran` subdirectory in the same directory as this README, and unpack the .bz2 files | ||
| into it. | ||
| * `rust`: `rustup` must be on the PATH. | ||
| * `rust`: `rustup` must be on the PATH. One can set `PYO3_NO_PYTHON=1` in `script_env:` to build without a Python interpreter (https://pyo3.rs/main/building-and-distribution#building-abi3-extensions-without-a-python-interpreter). |
| # available in the `target` packages for Python 3.12 and older, but are available on Python 3.13. | ||
| # However, since PyO3 0.16.4, it's possible to compile abi3 modules without sysconfig |
| build: | ||
| script_env: | ||
| - PYO3_NO_PYTHON=1 | ||
|
|
There was a problem hiding this comment.
Please remove the cryptography changes from this PR; we can do that in #1375.
| host: | ||
| - python |
There was a problem hiding this comment.
host: python is unnecessary, as this is the default for all packages whose source is downloaded from PyPI.
| if "rust" in self.non_python_build_reqs: | ||
| self.get_rust_env_vars(env) | ||
|
|
There was a problem hiding this comment.
Please add a comment explaining why this needs to be done after script_env.
| run(f"{os.environ['AR']} rc {self.host_env}/chaquopy/lib/lib{name}.a") | ||
|
|
||
| def extract_stdlib(self): | ||
| run(f"unzip -q -d {self.chaquopy_dir}/lib {self.std_lib_zip}") |
There was a problem hiding this comment.
Directly under lib is the wrong place for the Python standard library; it should be under lib/python3.13, for example. So are you sure this is actually having any effect? Maybe the build would work fine without it.
If it's really necessary, then please do the following:
- Change
std_libtostdlib, which is the more conventional spelling. - Merge
extract_stdlibintoextract_target, because making it a separate function is taking up more space for no benefit.
|
Anything update on the pydantic-core v2? |
|
Since PyPI and cibuildwheel now support Android, we now prefer everyone to submit PRs to each package's own repository. See the FAQ for instructions. As long as they're of sufficient quality, I will still accept PRs to update existing packages in the Chaquopy repository which don't have official Android wheels on PyPI yet. I'm unlikely to accept any new packages, unless they're very popular. |
As for Python 3.13 now includes sysconfig in Chaquopy build it is possible to directly build rust packages like pydantic-core.
This should fix #1017 at least for Python 3.13
In fact we should be able to build any rust-based package for Android this way.